package com.spring.demo8.eg12;

import org.springframework.beans.factory.DisposableBean;

import javax.annotation.PreDestroy;

/**
 * @author vhans
 */
public class ServiceC implements DisposableBean {
    public ServiceC() {
        System.out.println("创建ServiceC实例");
    }

    @PreDestroy
    public void preDestroy1() {
        System.out.println("preDestroy1()");
    }

    @PreDestroy
    public void preDestroy2() {
        System.out.println("preDestroy1()");
    }

    @PreDestroy
    public void preDestroy3() {
        System.out.println("preDestroy3()");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("DisposableBean接口中的destroy方法");
    }

    // 自定义的销毁方法
    public void customDestroy() {
        System.out.println("我是自定义的销毁方法customDestroy");
    }
}
